import 'package:flutter/cupertino.dart';

/// IMPORTANT!!!
///
/// Named route is NOT recommended anymore.
/// https://docs.flutter.dev/development/ui/navigation
///
/// Now we use:
/// - go_router for web.
/// - Navigator for others.
class RouteMapConfigService {
  // Flutter official suggests using go_router instead of navigator.
  static Map<Type, String> _navigatorConfig = {};

  static Map<String, String> _routeConfig = {};

  static void setRouteMapConfig(Map<String, String> config) {
    _routeConfig = config;
  }

  static Map<String, String> getRouteConfigAttribute() {
    return Map.unmodifiable(_routeConfig);
  }

  /// Flutter official suggests using go_router instead of navigator.
  static void setNavigatorMapConfig(Map<Type, String> config) {
    _navigatorConfig = config;
  }

  /// Flutter official suggests using go_router instead of navigator.
  static String? getNavigatorConfigAttribute(Widget widget) {
    return _navigatorConfig[widget.runtimeType];
  }
}
